﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Diploma.DAL.Hibernate.Abstract;
using Test.Diploma.BL.Managers;
using Diploma.DAL.Hibernate.Entity;

namespace Test.Diploma.UI.Web.MVC.Controllers
{
    public class HomeController : Controller
    {

        #region Fields

        private readonly IStoreManager _storeManager;

        #endregion

        #region Constructors

        public HomeController(IStoreManager storeManager)
        {
            this._storeManager = storeManager;
        }

        #endregion

        [HttpGet]
        public ActionResult Index()
        {
            return View();
        }

        [HttpPost]
        public ActionResult Index(string name)
        {
            IStore store = new Store {Name = name};
            _storeManager.CreateStore(store);
            return View();
        }

    }
}
